<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 
		 1.
		 		 if(false){
		 		     var a = 1;
		 		     let b = 2;
		 		 }
		 		 console.log(a);
		 		 console.log(b);
		 
		 Undefined、报错
		 	
		 		2.
		 		var a = 1;
		 		if(true){
		 		    console.log(a);
		 		    let a = 2;
		 		}
		 
		 报错
		 		
		 		3.
		 		var a = {n: 1}
		 		var b = a
		 		a.x = a = {n: 2}
		 		console.log(a.n, b.n);
		 		console.log(a.x, b.x);
		 
		 2 1	、{n:2}  
		 
		 		4.
		 		 console.log(c);
		 		 var c;
		 		 function c(a) {
		 		     console.log(a);
		 		     var a = 3;
		 		     function a(){
		 		     }
		 		 }
		 
		 		 function c(a) {
		 		     console.log(a);
		 		     var a = 3;
		 		     function a(){
		 		     }
		 		 }
		 
		 function a(){
		 		 }
		 
		 		 5.
		 		 var c = 1;
		 		 function c(c) {
		 		     console.log(c);
		 		     var c = 3;
		 		 }
		 		 console.log(c);
		 		 c(2);
		 
		 		 3 1 3
		 
		 		 6.
		 		 var name = 'erdong';
		 		 (function () {
		 		     if (typeof name === 'undefined') {
		 		         var name = 'chen';
		 		         console.log(name);
		 		     } else {
		 		         console.log(name);
		 		     }
		 		 })();
		 
		 erdong
		 
		 		7.
		 		var a = 10;  
		 		function test() {  
		 		    a = 100;  
		 		    console.log(a);  
		 		    console.log(this.a);  
		 		    var a;  
		 		    console.log(a); 
		 		}
		 		test();  
		 
		 100，10，100
		 		
		 		8.
		 		if (!('a' in window)) {
		 		    var a = 1;
		 		}
		 		console.log(a);
		 		
		 		9.
		 		var a = 1;
		 		
		 		function c(a, b) {
		 		    console.log(a);
		 		    a = 2;
		 		    console.log(a);
		 		}
		 		c();
		 
		 2，2
		 		
		 		10.
		 		var val=1;
		 		var obj={
		 		    val:2,
		 		    del:function(){
		 		        console.log(this);                    
		 		        this.val*=2;
		 		        console.log(val);
		 		    }
		 		}
		 		
		 		obj.del();
		 
		 2，1
		 		
		 		11.
		 		var name = "erdong";
		 		var object = {
		 		    name: "chen",
		 		    getNameFunc: function () {
		 		        return function () {
		 		            return this.name;
		 		        }
		 		    }
		 		}
		 		console.log(object.getNameFunc()());
		 		
		 Chen
		 
		 		12.
		 		var name = "erdong";
		 		var object = {
		 		    name: "chen",
		 		    getNameFunc: function () {
		 		        var that = this;
		 		        return function () {
		 		            return that.name;
		 		        }
		 		    }
		 		}
		 		console.log(object.getNameFunc()());
		 
		 Chen
		 		
		 		13.
		 		(function() {
		 		  var a = b = 3;
		 		})();
		 		console.log(typeof a === 'undefined');
		 		console.log(typeof b === 'undefined');
		 		
		 Undefinde、3
		 		14.
		 		console.log(typeof NaN === 'number');
		 
		 NaN
		 
		 		15.
		 		console.log(1 + "2" + "2");
		 		122
		 
		 		console.log(1 + +"2" + "2");
		 		报错
		 
		 		console.log(1 + -"1" + "2");
		 		02
		 
		 		console.log(+"1" + "1" + "2"); 
		 		112
		 
		 		console.log( "A" - "B" + "2"); 
		 		NaN2
		 
		 		console.log( "A" - "B" + 2); 
		 		NaN
		 
		 		16.
		 		var a = 666;
		 		console.log(++a);
		 		console.log(a++);
		 		console.log(a);
		 		
		 666、667、666
		 
		 		17.
		 		console.log(typeof a);
		 		function a() {}
		 		var a;
		 		console.log(typeof a);
		 		
		 Undefined、undefined
		 
		 		18.
		 		var a;
		 		var b = 'undefined';
		 		console.log(typeof a);
		 		console.log(typeof b);
		 		console.log(typeof c);
		 		
		 Undefined、undefined、报错
		 
		 		19.
		 		var x = 1;
		 		if(function f(){}){
		 		    x += typeof f;
		 		}
		 		console.log(x);
		 		
		 1
		 
		 		20.
		 		var str = "123abc";
		 		console.log(typeof str++);
		 		
		 123abc1
		 
		 		21.
		 		console.log('b' + 'a' + +'a'+'a');
		 
		 报错
		 
		 		22.
		 		var obj = {n: 1};
		 		function fn2(a) {
		 		    a.n = 2;
		 		}
		 		fn2(obj);
		 		console.log(obj.n);
		 		
		 2
		 
		 		23.
		 		var x = 10;
		 		function fn() {
		 		    console.log(x);
		 		}
		 		function show(f) {
		 		    var x = 20;
		 		    f();
		 		}
		 		show(fn);
		 		
		 10、10
		 
		 		24.
		 		function foo1() {
		 		    return {
		 		        bar: "hello"
		 		    };
		 		}
		 		function foo2() {
		 		    return 
		 		    {
		 		        bar: "hello"
		 		    };
		 		}
		 		console.log(foo1());
		 		console.log(foo2());
		 		
		 Hello、{bar:”hello”}
		 
		 		25.
		 		console.log((function(){ return typeof arguments; })());
		 undefined
		 		
		 		26.
		 		console.log(0.1 + 0.2 == 0.3);
		 true-->
	</body>
</html>